//
//  AppDelegate.swift
//  QualityControlSystem
//
//  Created by Daniel Hu on 12/26/16.
//  Copyright © 2016 com.mask. All rights reserved.
//

import UIKit
import IQKeyboardManagerSwift
import Siren

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        IQKeyboardManager.sharedManager().enable = true
        SettingManager.applyDefaultSetting()
        StyleManager.applyStyle(to: window!)

        window = UIWindow(frame: UIScreen.main.bounds)
        AppViewController.initialAppViewControllerFromDefaultStoryBoard().launchApp(in: window!)
        
        // version check
        Siren.sharedInstance.checkVersion(checkType: .immediately)
        
        return true
    }
    
    func applicationDidBecomeActive(_ application: UIApplication) {
        Siren.sharedInstance.checkVersion(checkType: .daily)
    }
    
    func applicationWillEnterForeground(_ application: UIApplication) {
        Siren.sharedInstance.checkVersion(checkType: .immediately)
    }

}

